package com.lcx.security.security;

import com.lcx.utils.utils.MD5;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class DefaultPasswordEncoding implements PasswordEncoder {

    public DefaultPasswordEncoding(){
        this(-1);
    }

    public DefaultPasswordEncoding(int strength){

    }

    //进行MD5加密
    @Override
    public String encode(CharSequence charSequence) {
        return MD5.encrypt(charSequence.toString());
    }

    @Override
    public boolean matches(CharSequence charSequence, String s) {
        return s.equals(MD5.encrypt(charSequence.toString()));
    }

}
